using System;
using System.Collections.Generic;
using System.Text;

namespace Accountability4net
{
    /// <summary>
    /// This exception occurs if the sum of amount for <see cref="IAction">actions</see> of type <see cref="ActionType.DEBIT" />
    /// is not equal to the sum of amount for <see cref="IAction">actions</see> of type <see cref="ActionType.CREDIT" />
    /// when a <see cref="ITransaction">transaction</see> is <see cref="ITransaction.Commit()">committed</see>.
    /// </summary>
    public class UnbalancedTransactionException: Exception
    {
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="transaction">The transaction the exception occurred in</param>
        public UnbalancedTransactionException(ITransaction transaction)
            :this(transaction, "Difference between debit and credit sums not allowed")
        {
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="transaction">The transaction the exception occurred in</param>
        /// <param name="message">Message describing more details about the exception</param>
        public UnbalancedTransactionException(ITransaction transaction, string message)
            : base(message)
        {
        }

    }
}
